# Custom makefile for Archive Extractor
# Copyright 2008-2009 Matthew Hoops


# When this is disabled, zlib functions are disabled
ENABLE_ZLIB= 1

# When this is disabled, bzip2 functions are disabled
ENABLE_BZIP2= 1


# These are files which are not individual archives
BASE_FILES= \
	main.cpp \
	file_reader.cpp

# These are archive-related files
ARCHIVE_FILES= \
	binhex.cpp \
	d64.cpp \
	ea_wad.cpp \
	gob.cpp \
	iso_image.cpp \
	lab.cpp \
	ms_cab.cpp \
	ms_comp.cpp \
	quakepak.cpp \
	rar.cpp \
	stuffit.cpp \
	tar.cpp \
	zip.cpp
	
# External libraries that need to be compiled in are defined here
ALL_LIBS=

# Defines for the code that need to be compiled in are defined here
DEFINES=

# Enable zlib if requested
ifeq "$(ENABLE_ZLIB)" "1"
	ALL_LIBS := $(ALL_LIBS) -lz
	DEFINES := $(DEFINES) -DENABLE_ZLIB
	ARCHIVE_FILES := $(ARCHIVE_FILES) gzip.cpp
endif

# Enable bzip2 if requested
ifeq "$(ENABLE_BZIP2)" "1"
	ALL_LIBS := $(ALL_LIBS) -lbz2
	DEFINES := $(DEFINES) -DENABLE_BZIP2
	ARCHIVE_FILES := $(ARCHIVE_FILES) bzip2.cpp
endif
	
# Use this if on Windows...
APP_SUFFIX=
	
# This is the default app name
APP_NAME= arc_ex

# Any warning flags are declared here
WARNING_FLAGS= \
	-Wall

# This is the basic compile
all:
	g++ -o $(APP_NAME)$(APP_SUFFIX) $(DEFINES) $(WARNING_FLAGS) $(BASE_FILES) $(ARCHIVE_FILES) $(ALL_LIBS)
	strip $(APP_NAME)$(APP_SUFFIX)
	
# Remove the app only for now
clean:
	rm $(APP_NAME)$(APP_SUFFIX)